<template>
  <div id="app">
    <van-tabbar
      class="tabbar"
      v-show="$route.meta.tabbar"
      v-model="activeIndex"
      @change="handleChange"
    >
      <van-tabbar-item icon="home-o" to="/">闲鸭</van-tabbar-item>
      <van-tabbar-item icon="apps-o" to="/category">分类</van-tabbar-item>
      <van-tabbar-item icon="chat-o" to="/chart">消息</van-tabbar-item>
      <van-tabbar-item icon="manager-o" to="/account">我的</van-tabbar-item>
    </van-tabbar>
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive">
      <!-- 这里是不被缓存的视图组件，比如 Edit！ -->
    </router-view>
  </div>
</template>

<script>
import Vue from "vue";
import { Tabbar, TabbarItem } from "vant";

Vue.use(Tabbar).use(TabbarItem);
export default {
  name: "App",
  data() {
    return {
      activeIndex: 0
    };
  },
  watch: {},
  methods: {
    handleChange() {}
  },
  components: {}
};
</script>
<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  text-align: center;
}
</style>
